package com.example.houduan.Mapper;

import com.example.houduan.Pojo.DrugCompany;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DrugCompanyMapper {

    @Select("select * from drugcompany where state=0")
    List<DrugCompany> selectAllDrugCompany();

    @Select("select count(*) from drugcompany where state=0")
    int selectDrugCompanyCount();

    List<DrugCompany> selectDrugCompanyLimit(int b,int e);

    @Update("UPDATE drugcompany set state=1 where company_id=#{company_id}")
    int deleteDrugCompany(Integer company_id);

    @Update("UPDATE drugcompany set company_name=#{company_name},company_phone=#{company_phone},dc_createtime=#{dc_createtime},dc_updatetime=#{dc_updatetime},latitude=#{latitude},longitude=#{longitude},city_id=#{city.city_id} where company_id=#{company_id}")
    int updateDrugCompany(DrugCompany drugCompany);

    @Insert("insert into drugcompany values (#{company_id},#{company_name},#{company_phone},#{dc_updatetime},#{dc_createtime},#{latitude},#{longitude},#{city.city_id},default)")
    int insertDrugCompany(DrugCompany drugCompany);

    List<DrugCompany> selectDrugCompanyByConditions(Integer company_id,String company_name,String city_name);
}
